﻿using Mathmall.Administration.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace Mathmall.Administration.Data
{
    public class RoleMenuEntityTypeConfiguration : IEntityTypeConfiguration<RoleMenu>
    {
        public void Configure(EntityTypeBuilder<RoleMenu> builder)
        {
            builder.ToTable("RoleMenu")
                .ToTable(tableBuilder => tableBuilder.HasComment("角色菜单表"));

            builder
                .HasKey(roleMenu => roleMenu.RoleMenuID)
                .HasName("RoleMenuID");

            builder
                .Property(roleMenu => roleMenu.RoleId)
                .HasColumnType("int")
                .IsRequired(true);

            builder
                .Property(roleMenu => roleMenu.MenuId)
                .HasColumnType("int")
                .IsRequired(true);
        }
    }
}